package com.culturesalon.util;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

public class MD5Util {
	public static String EncodePwdByMd5(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException{
		MessageDigest md5=MessageDigest.getInstance("MD5");
		BASE64Encoder base64en=new BASE64Encoder();
		return base64en.encode(md5.digest(password.getBytes("UTF-8")));
		
	}
	public static void main(String[] args) throws NoSuchAlgorithmException, UnsupportedEncodingException{
		System.out.println(MD5Util.EncodePwdByMd5("admin888"));
	}
}
